package com.TEAM6.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;

import javax.sql.DataSource;
import com.TEAM6.beans.NoticeInfo;

public class BoardDao {
	private Connection  road;
	private PreparedStatement car;
	private ResultSet results;
	private DataSource ds;
	public ArrayList<NoticeInfo>searchBooks(String word){
		ArrayList<NoticeInfo> list = new ArrayList<NoticeInfo>();
		String sql = "";
		
		
		try {
			road = ds.getConnection();
			car = road.prepareStatement(sql);
			car.setNString(1, word);
			
			results = car.executeQuery();
			while (results.next()){
				NoticeInfo e = new NoticeInfo();
				e.setContext(results.getNString("context"));
				e.setTitle(results.getNString("Title"));
				e.setDate(results.getDate("Date"));
				e.setWriter("");
				e.setFile(results.getNString("FIL"));
				
				list.add(e);
			}
		}catch(Exception e){
			e.printStackTrace();
		}
		
		return list;
	}
}

